package com.flyduck.mall.oms.remote.controller;

import com.flyduck.mall.oms.remote.service.RemoteOrderItemService;
import com.flyduck.ss.common.core.domain.R;

import com.flyduck.mall.oms.api.vo.RemoteOrderItemRespVO;
import com.flyduck.mall.oms.api.vo.RemoteOrderItemUpdateReqVO;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * RemoteOrderController
 * </p>
 *
 * @author flyduck
 * @since 2024-07-23
 */
@RestController
@RequestMapping("/order/remote/order")
public class RemoteOrderItemController {

    @DubboReference
    private RemoteOrderItemService remoteOrderItemService;

    //@InnerAuth
    @GetMapping("/getOrderItemById/{id}")
    public R<RemoteOrderItemRespVO> getOrderItemById(@PathVariable("id") Long id){
        RemoteOrderItemRespVO remoteOrderItemRespVO = remoteOrderItemService.getOrderItemById(id);
        return R.ok(remoteOrderItemRespVO);
    }

    //@InnerAuth
    @GetMapping("/updateOrderItem")
    R<Void> updateOrderItem(@RequestBody RemoteOrderItemUpdateReqVO remoteOrderItemUpdateReqVO){
        remoteOrderItemService.updateOrderItem(remoteOrderItemUpdateReqVO);
        return R.ok();
    }

}
